package chepter06.example03;

import java.util.ArrayList;
import java.util.Iterator;

public class Example03 {
    public static void main(String[] args) {
        ArrayList List = new ArrayList();
        List.add("张三");//向列表中添加String对象
        List.add("李四");
        List.add("王五");
        List.add("赵六");
        //迭代器
        Iterator it = List.iterator();//返回一个列表的迭代器对象
        while (it.hasNext()){
            //所有的类都继承自Object类
            Object object = it.next();

            System.out.println(object);
        }

    }
}
